package jfae.core.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.Date;

/**
 * Allow you to define all standard editables constraints
 * at class level.
 * Given the above class definition
 * <div class="codeblock">
 * <pre>
 * &#64;EditableBean(exclusionNames="excludedProp", propsPresentation={
 * 		&#64;PropPresentation(name="stringProp",order=1,presentation=&#64;Presentation(label="Alfanumerico")),
 * 		&#64;PropPresentation(name="integerProp",order=2)
 * })
 * public class BaseBean {
 * 
 * 	private String stringProp;
 * 	private Integer integerProp;
 * 	private String excludedProp;
 * 	
 * 	public String getStringProp() {
 * 		return stringProp;
 * 	}
 * 	public void setStringProp(String stringProp) {
 * 		this.stringProp = stringProp;
 * 	}
 * 	public Integer getIntegerProp() {
 * 		return integerProp;
 * 	}
 * 	public void setIntegerProp(Integer integerProp) {
 * 		this.integerProp = integerProp;
 * 	}
 * 	public String getExcludedProp() {
 * 		return excludedProp;
 * 	}
 * 	public void setExcludedProp(String excludedProp) {
 * 		this.excludedProp = excludedProp;
 * 	}
 * }
 * </pre>
 * </div>
 * The property <code>stringProp</code> have order 1 and label "Alfanumerico"
 * The property <code>integerProp</code> have order 2 and default values for 
 * presentation constraints
 * @author bobpuley
 *
 */
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface EditableBean {

	/**
	 * The properties black list
	 * @return a set of string representing props names to 
	 * exclude from editable processing 
	 */
	String[] exclusionNames() default {"class"};
	
	/**
	 * You can specify a set of properties in a specified
	 * order. This order will used by parser to reorder 
	 * field list before return them
	 * @return
	 */
	String[] reorderProperties() default {};

	/**
	 * The same of {@link #exclusionNames()}, but proceeding
	 * by property type. For example you can decide to exclude
	 * by editing all {@link Date} properties 
	 * @return a classes set of type to not include in editable fields
	 */
	Class<?>[] exclusionTypes() default {};
	
	/**
	 * The presentation constraints {@link PropPresentation}
	 * @return the presentation constraints
	 */
	PropPresentation[] propsPresentation() default {};
}
